package com.jjy.admin.controller.echarts;

import com.jjy.admin.service.echarts.EchartService;
import com.jjy.common.annotation.ApiResource;
import com.jjy.common.domain.R;
import com.jjy.common.enums.ResBizTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 通用方法
 *
 * @author jjy
 */
@RestController
@RequestMapping("echarts")
@ApiResource(name = "图表", resBizType = ResBizTypeEnum.SYSTEM)
public class EchartController {
    @Autowired
    private EchartService echartService;


    @GetMapping("getNumberData")
    public R getNumberData() {
        List numberData = echartService.getNumberData();
        return R.ok().put(numberData);
    }
    @GetMapping("getGiftWords")
    public R getGiftWords() {
        List giftWords = echartService.getGiftWords();
        return R.ok().put(giftWords);
    }

       @GetMapping("getConfigData")
    public R getConfigData() {
        List legendData = echartService.getConfigData();

        return R.ok().put(legendData);
    }

      @GetMapping("getColumnarData")
    public R getColumnarData() {
        Map lumnarData = echartService.getColumnarData();

        return R.ok().put(lumnarData);
    }
     @GetMapping("getSalaryByExperience")
    public R getSalaryByExperience() {
        List salaryByExperience = echartService.getSalaryByExperience();
        List experienceByExperience = echartService.getExperienceByExperience();

         HashMap<Object, Object> result = new HashMap<>();
         result.put("salaryByExperience",salaryByExperience);
         result.put("experienceByExperience",experienceByExperience);
         return R.ok().put(result);
    }

    @GetMapping("getConeData")
    public R getConeData() {
        List coneData = echartService.getConeData();
        return R.ok().put(coneData);
    }

}